﻿using FluentAssertions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;

namespace MyCompany.WebCrawler.Test.Domain.UiFetcher.Given_Links
{
    [TestClass]
    public class When_ShowThem : Context
    {
        private Mock<WebCrawler.Domain.UiFetcher> mock;
        private string result = "";
        
        public override void Arrange()
        {
            mock = new Mock<WebCrawler.Domain.UiFetcher>();
            mock.Setup(f => f.Show(It.IsAny<string>())).Callback<string>(url => result += url);
        }

        public override void Act()
        {
            var fetcher = mock.Object;
            fetcher.Show("http://google.com");
        }

        [TestMethod]
        public void Then_LinkIsShown()
        {
            result.Should().Be("http://google.com");
        }
    }
}